Repository navigation
Escape each control character of a tool word and check float ints - #65
Merged
Merged
Conversation
word() writes NUL, VT, FF, and each other control character as \u00XX, so a tool argument stays one Tcl word. argInt() refuses a float that is not finite or is out of the exact integer range of f64.
beetlebugorg
force-pushed
the
mcp-args
branch
from
November 28, 2026 00:50
61411aa to
d1450e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #15.
word()of src/app/mcp.zig escaped \n, \r, and \t only. Tcl splits words at \v and \f too, and a NUL ends a C string. Each other control character (0x00 to 0x1f and 0x7f) now goes into the word as\\u00XX, so a tool argument stays one Tcl word.argInt()converted any JSON float with@intFromFloat(@round(f)), which is illegal behavior for 1e300, an infinity, or NaN (undefined in ReleaseFast). A float that is not finite or is beyond 2^53 is nowerror.BadArgument.Tests: a VT, an FF, and a NUL in a
typeargument stay in one word; 2.6 gives 3; 1e300 and NaN giveBadArgument. Local:zig fmt --checkandzig ast-checkpass. The tests are not run locally, since builds are paused on this host; QA runs them.